
module.exports = {
	http: {
		curl: async function(url, req = {
			method: 'get'
		}) {
			const res = await uniCloud.httpclient.request(url, {
				method: req.method,
				data: req.data,
				contentType: 'json',
				dataType: 'json'
			});
	
			return res;
		},
		get: async function(url) {
			const res = await this.curl(url);
	
			return res.data;
		},
		post: async function(url, data) {
			const res = await this.curl(url, {
				method: 'post',
				data: data
			});
	
			return res.data;
		}
	}
}
